﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;

public partial class index : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        /*Movie m = new Movie();
        m.HotMovie();
        DAL.Movies dm = new DAL.Movies();
        dm = m.HotMovie();
        movimg.Src = dm.image_url;
        movname.InnerText = dm.name;
         
        Movie n = new Movie();
        mv.DataSource = n.Message();
        mv.DataBind();*/

        //声明逻辑层电影类的对象
        Movie m = new Movie();
        //声明数据层对象，用于存储最热电影院
        DAL.Movies HM = new DAL.Movies();
        //调用方法得到最热电影院
        HM = m.HotMovie();
        HT_img.Src = HM.image_url;
        lbName1.Text = HM.name;
        int j = 0;
        IQueryable<DAL.Movies> ML = m.showMovie();
        foreach (var u in ML)
        {
            j++;
            if (j == 1)
            {
                lb1Name1.Text = u.name;
                lb1Time1.Text = u.time.ToString();

            }
            if (j == 2)
            {
                lb2Name1.Text = u.name;
                lb2Time1.Text = u.time.ToString();

            }
            if (j == 3)
            {
                lb3Name1.Text = u.name;
                lb3Time1.Text = u.time.ToString();

            }
            if (j == 4)
            {
                lb4Name1.Text = u.name;
                lb4Time1.Text = u.time.ToString();

            }
            if (j == 5)
            {
                lb5Name1.Text = u.name;
                lb5Time1.Text = u.time.ToString();
            }

        }
        int X=0;
        IQueryable<DAL.Movies> MO = m.Message();
        foreach (var u in MO)
        {
            X++;
            if (X == 1)
            {
                Img1.Src = u.image_url;
                lb1.Text = u.name;

            }
            if (X == 2)
            {
                Img2.Src = u.image_url;
                lb2.Text = u.name;

            }
            if (X == 3)
            {
                Img3.Src = u.image_url;
                lb3.Text = u.name;

            }
            if (X == 4)
            {
                Img4.Src = u.image_url;
                lb4.Text = u.name;

            }
          
        }



        //声明逻辑层电影类的对象
        Cinema c = new Cinema();
    /*
        Repeater1.DataSource = c.Meg();
        Repeater1.DataBind();
        //声明数据层对象，用于存储最热电影院
         */
        DAL.Cinemas HC = new DAL.Cinemas();
            //调用方法得到最热电影院
            HC = c.HotCinema();
            hot_img.Src = HC.image_url;
            lbName.Text = HC.name;
            lbAdd.Text = HC.address;
            lbTel.Text = HC.tel;
            //显示最热电影院最近上映的电影
            int i = 0;
            IQueryable<DAL.MovieLists> ML2 = c.showMovie(HC.name);
            foreach (var v in ML2)
            {
                i++;
                if (i == 1)
                {
                    lb1Name.Text = v.movie;
                    lb1Time.Text = v.time.ToString();

                }
                if (i == 2)
                {
                    lb2Name.Text = v.movie;
                    lb2Time.Text = v.time.ToString();

                }
                if (i == 3)
                {
                    lb3Name.Text = v.movie;
                    lb3Time.Text = v.time.ToString();

                }
                if (i == 4)
                {
                    lb4Name.Text = v.movie;
                    lb4Time.Text = v.time.ToString();

                }
                if (i == 5)
                {
                    lb5Name.Text = v.movie;
                    lb5Time.Text = v.time.ToString();
                }
            }
       
            int Y = 0;
            IQueryable<DAL.Cinemas> Ci = c.Meg();
            foreach (var v in Ci)
            {
                Y++;
                if (Y == 1)
                {
                    Mg1.Src = v.image_url;
                    text_1.Text = v.name;
                    
                }
                if (Y == 2)
                {
                    Mg2.Src = v.image_url;
                    text_2.Text = v.name;

                }
                if (Y == 3)
                {

                    Mg3.Src = v.image_url;
                    text_3.Text = v.name;
                }
                if (Y == 4)
                {
                    Mg4.Src = v.image_url;
                    text_4.Text = v.name;

                }
               
            }
        //微评读取
         int C = 0;
        //声明Commen类的对象
        Comment cm=new Comment();
            IQueryable<DAL.CommentsOfMovies> sc = cm.showC();
            foreach (var v in sc)
            {
                C++;
                if (C == 1)
                {
                    name1.Text = v.Users.name;
                  // movie1.Text =v.Movies.name;
                    text1.Text = v.comment;

                }
                if (C == 2)
                {
                    name2.Text = v.Users.name;
                    // movie2.Text =v.Movies.name;
                    text2.Text = v.comment;


                }
                if (C == 3)
                {

                    name3.Text = v.Users.name;
                    // movie3.Text =v.Movies.name;
                    text3.Text = v.comment;

                }
                if (C == 4)
                {
                    name4.Text = v.Users.name;
                    // movie4.Text =v.Movies.name;
                    text4.Text = v.comment;

                }
                if (C == 5)
                {
                    name5.Text = v.Users.name;
                    // movie5.Text =v.Movies.name;
                    text5.Text = v.comment;

                }
            }
               
        }
    }

  